package com.endi.sap.service;

import com.endi.sap.dingding.QueryDataByInstId;
import com.endi.sap.entity.BaseInfo;
import com.endi.sap.entity.vo.ResultVo;
import com.endi.sap.enums.DingDingActionEnums;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class CustomerMaterialService {

    @Autowired
    private QueryDataByInstId queryDataByInstId;

    public ResultVo actionBuildFactory(BaseInfo baseInfo,Map<String, Object> map){
        ResultVo resultVo = new ResultVo();
        String saveOrUpdateAction = (String) map.get("saveOrUpdateAction");
        String queryAction = (String) map.get("queryAction");
        String deleteAction = (String) map.get("deleteAction");
        if(!StringUtils.isEmpty(saveOrUpdateAction) && saveOrUpdateAction.equals("true")){
            //新增
            String formInsId = (String) map.get("formInsId");
            //根据formInsId查询实例数据
            queryDataByInstId.query(baseInfo,formInsId);
            //response.body========>解析实体，组装entity
            //发送数据到SAP

        }

        if(!StringUtils.isEmpty(queryAction) && queryAction.equals("true")){
            //查询
        }

        if(!StringUtils.isEmpty(deleteAction) && deleteAction.equals("true")){
            //修改
        }
        return resultVo;
    }

}
